#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<fstream>
#include<cmath>
#include<map>
using namespace std;
int n,a[1000000],m,f[1000000],k;
void work(int t){
	for(int i=1;i<=n;i++){
		if(a[i]==-1) continue;
		if(t!=a[i]){
			t=a[i];
			f[++k]=i;
			a[i]=-1;
			continue;
		}
	}
}
int main(){
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	cin>>n;
	m=n;
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	while(m){
		k=0;
		work(-1);
		for(int i=1;i<=k;i++)
		cout<<f[i]<<" ";
		cout<<endl;
		m-=k;
	}
	return 0;
}
